package main

type ListNode struct {
	Val  int
	Next *ListNode
}

/**
 *
 * @param head ListNode类
 * @return ListNode类
 */
func deleteDuplicates(head *ListNode) *ListNode {
	// write code here
	pummy := new(ListNode)
	pummy.Next = head
	slow, fast, last := head, head, pummy
	for slow != nil {
		for fast != nil && fast.Val == slow.Val {
			fast = fast.Next
		}
		if fast == slow.Next {
			last = last.Next
		}
		last.Next, slow = fast, fast
	}
	return pummy.Next
}
